package com.bdan.t382.factory;

import com.bdan.t382.dao.PetDao;
import com.bdan.t382.dao.imp.PetDaoMySQLImpl;
import com.bdan.t382.dao.imp.PetDaoOracleImpl;

import java.util.Stack;

public class PetDaoFactory {
    //此默认名称可以通过读取properties配置文件进行修改
    public static String defaultBeanName="PetDaoMySQLImpl";
    public static PetDao getInstance(String beanName){

        PetDao petDao=null;
        switch (beanName){
            case "PetDaoMySQLImpl":
                petDao=new PetDaoMySQLImpl();
                break;
            case "PetDaoOracleImpl":
                petDao =new PetDaoOracleImpl();
                break;
            default:
                throw new RuntimeException("未找到‘"+beanName+"'对应的对象。");


        }
return petDao;
    }
}
